<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<script type="text/javascript">
<!--

//-->

function CheckCheckAll(Check_ctr) {
	chk = document.getElementsByName('selectedCategory');
	if (Check_ctr.checked == true) {
		chk.checked = true;
		for (i = 0; i < chk.length; i++) {
			chk[i].checked = true;
		}
	} else {
		chk.checked = false;
		for (i = 0; i < chk.length; i++) {
			chk[i].checked = false;
		}
	}
}

function deleteShop() {
	var flag = false;
	chk = document.getElementsByName('selectedCategory');
	for (i = 0; i < chk.length; i++) {
		if(chk[i].checked == true) {
			flag = true;
			break;
		}
	}

	if(flag) {
		return wantToDelete('Want to delete selected shops?');
	} else {
		alert('Select at least one shop to delete...');
		return false;
	}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td>
			<div class="blue-text16" style="margin: 0px 0px 0px 0px">
				<table width="100%">
					<tr>
						<td class="heding" align="left">
							<s:text name="addShopToFavorite.header" />
						</td>
						<td align="left">
							<a href="addToFavoriteShops.htm" class="common-link"><s:text name="addToFavoriteShops.title" /></a>
						</td>
					</tr>
				</table>
			</div>
			<div class="header-separator-bg" style="margin: 10px 5px 17px 0px"></div>
			<div style="margin: 0px 0px 12px 0px">

		<s:form action="deleteMultiFavoriteShop.htm" theme="simple" id="form" onsubmit="return deleteShop()" method="post">

			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tbody>
					<tr>
						<td>
							<display:table name="favoritesShopsList" pagesize="10" requestURI="favoriteShops.htm" id="row">
								<display:column title="<input type='checkbox' name='selectall' onclick='CheckCheckAll(this)' />" style="width: 5%; text-align: center" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
									<s:checkbox name="selectedCategory" theme="simple" fieldValue="%{#attr.row.id}" />
								</display:column>
								<display:column title="Title:" style="width: 60%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
									<a href="browseItems.htm?titleValue=${row.name}&type=6&city=${row.location}&locations=${row.region.categoryId}&cid=${row.generalCategories.categoryId}"  /><s:property value="#attr.row.name" /></a>
								</display:column>
								<display:column title="Added" style="width: 20%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
									<s:date name="%{#attr.row.date}" format="dd MMMM yyyy" />
								</display:column>
								<display:column autolink="true" title="Options" style="width: 15%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
									<table>
											<tr>
												<td align="center" valign="top" class="grid-bg common-text" id="mddm" width="10%">
													<a class="mddm" href="#" onmouseover="mopen('<s:property value="%{#attr.row.id}"/>', this, 'common-link', 'right', 1)"
														onmouseout="mclosetime()">Select</a>
													<div style="visibility: hidden;" id="<s:property value="%{#attr.row.id}"/>"
														onmouseover="mcancelclosetime()"
														onmouseout="mclosetime()">
														<s:a href="editFavoriteShops.htm?uid=%{#attr.row.id}">Edit</s:a>
														<s:a href="javascript: wantToDeleteWithURL('deleteFavoriteShops.htm?uid=%{#attr.row.id}', 'Do you want to delete this shop?')">Delete</s:a>
													<s:if test="#attr.row.note != null && #attr.row.note != ''">
														<s:a href="addEditNoteToFavoriteShops.htm?fuid=%{#attr.row.id}">Edit Note</s:a>
													</s:if>
													<s:else>
														<s:a href="addEditNoteToFavoriteShops.htm?fuid=%{#attr.row.id}">Add Note</s:a>
													</s:else>
														<s:a href="viewSellersOtherItems.htm?userId=%{#attr.row.user.id}&action=favoriteShops">View sellers other items</s:a>
														<!-- <a href="mailto:<s:property value="#attr.row.user.email" />">Contact</a> -->
														<s:a href="userShop.htm?userId=%{#attr.row.user.userId}">View similar shop</s:a>
													</div>
												</td>
											</tr>
										</table>
								</display:column>
								<display:column>
									<tr>
										<td colspan="4" bgcolor="#ffffdd">
											<c:out value="${row.note}"></c:out>
										</td>
									</tr>
								</display:column>
							</display:table>
						</td>
					</tr>
					<tr>
						<td width="100%">
							<table border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td><img src="images/middle/btn-grey-left1.gif" alt=" " width="6" height="23" /></td>
									<td class="btn-grey-middle1 "><s:submit name="delete" value="delete" align="left" theme="simple" cssClass="submit-btn-common" /></td>
									<td><img src="images/middle/btn-grey-right1.gif" alt=" " width="6" height="23" /></td>
								</tr>
							</table>
						</td>
					</tr>
				</tbody>
			</table>
		</s:form>
			</div>
		</td>
	</tr>
</table>